#Game: Vice City Stories
#Author: danssmnt
#Version: v0.1
#Category: Side Missions
#Date: 2025-12-02
#Description: Hot Single ~r~Red Balloons~w~ in your area!

// TODO //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// - Find a way to disable / dim blips for balloons that have already burst
// - Find another way to load positions into vars (goto 99RED_34 label?)
// - Make a 'Hidden Package Radar' for GTA: LCS as well...
//
// TODO //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// VARIABLES /////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Blip Array Indexes (for iteration over all 99 balloons)
0004: 0@ = 0
0004: 1@ = 0

// Max. Range Radar (in meters?)
0005: 2@ = 750.0

// 3@ -> Balloon blip array (99 elements)

// $4174(balloonid,99) -> Balloon X Position
// $4273(balloonid,99) -> Balloon Y Position
0005: $4174 = -1028.81
0005: $4273 = -1100.82
0005: $4175 = -1254.66
0005: $4274 = -1055.04
0005: $4176 = -1260.205
0005: $4275 = -1271.914
0005: $4177 = -1382.07
0005: $4276 = -851.99
0005: $4178 = -1772.52
0005: $4277 = -510.6
0005: $4179 = -1147.19
0005: $4278 = -454.13
0005: $4180 = -1591.16
0005: $4279 = -302.49
0005: $4181 = -1132.15
0005: $4280 = -637.45
0005: $4182 = -1022.37
0005: $4281 = -345.83
0005: $4183 = -1135.9
0005: $4282 = -1367.85
0005: $4184 = -848.43
0005: $4283 = -1496.52
0005: $4185 = -663.79
0005: $4284 = -1288.32
0005: $4186 = -845.72
0005: $4285 = -893.93
0005: $4187 = -860.82
0005: $4286 = -689.55
0005: $4188 = -1757.01
0005: $4287 = -187.23
0005: $4189 = -852.59
0005: $4288 = -632.76
0005: $4190 = -507.79
0005: $4289 = -422.28
0005: $4191 = -341.42
0005: $4290 = -598.47
0005: $4192 = -16.34
0005: $4291 = 1222.55
0005: $4193 = -1194.28
0005: $4292 = -327.7
0005: $4194 = -1180.93
0005: $4293 = -86.54
0005: $4195 = -1202.01
0005: $4294 = -49.55
0005: $4196 = -1175.18
0005: $4295 = 103.1
0005: $4197 = -1291.35
0005: $4296 = 99.47
0005: $4198 = -1097.69
0005: $4297 = 294.95
0005: $4199 = -913.54
0005: $4298 = 202.92
0005: $4200 = -818.62
0005: $4299 = 320.41
0005: $4201 = -912.97
0005: $4300 = 53.28
0005: $4202 = -968.44
0005: $4301 = -142.67
0005: $4203 = -785.6
0005: $4302 = 410.94
0005: $4204 = -837.86
0005: $4303 = 598.14
0005: $4205 = -652.32
0005: $4304 = 666.02
0005: $4206 = -694.52
0005: $4305 = 716.23
0005: $4207 = -768.04
0005: $4306 = 891.89
0005: $4208 = -890.95
0005: $4307 = 826.55
0005: $4209 = -1250.17
0005: $4308 = 1493.91
0005: $4210 = -889.74
0005: $4309 = 1531.86
0005: $4211 = -852.52
0005: $4310 = 1460.12
0005: $4212 = -914.83
0005: $4311 = 1344.54
0005: $4213 = -778.94
0005: $4312 = 1110.04
0005: $4214 = -586.1838
0005: $4313 = 1175.243
0005: $4215 = -534.73
0005: $4314 = 954.27
0005: $4216 = -489.37
0005: $4315 = 821.72
0005: $4217 = -325.77
0005: $4316 = 1107.7
0005: $4218 = -292.17
0005: $4317 = 1277.54
0005: $4219 = -447.68
0005: $4318 = 1287.74
0005: $4220 = -637.35
0005: $4319 = 1455.07
0005: $4221 = -476.75
0005: $4320 = 984.35
0005: $4222 = 36.7
0005: $4321 = 1159.47
0005: $4223 = -72.14
0005: $4322 = 1029.25
0005: $4224 = 59.06
0005: $4323 = 914.16
0005: $4225 = 274.36
0005: $4324 = 990.51
0005: $4226 = 397.33
0005: $4325 = 1077.77
0005: $4227 = 407.7
0005: $4326 = 1047.88
0005: $4228 = 471.24
0005: $4327 = -1716.14
0005: $4229 = 202.58
0005: $4328 = 1237.73
0005: $4230 = 530.63
0005: $4329 = 1320.54
0005: $4231 = 602.54
0005: $4330 = 893.93
0005: $4232 = 511.19
0005: $4331 = 765.9
0005: $4233 = 331.07
0005: $4332 = 720.34
0005: $4234 = 441.05
0005: $4333 = 607.0
0005: $4235 = 577.28
0005: $4334 = 457.94
0005: $4236 = 586.22
0005: $4335 = 594.91
0005: $4237 = 416.79
0005: $4336 = 516.94
0005: $4238 = 189.86
0005: $4337 = 379.58
0005: $4239 = 302.35
0005: $4338 = 387.21
0005: $4240 = 96.46
0005: $4339 = 552.3
0005: $4241 = 374.36
0005: $4340 = 262.95
0005: $4242 = 472.63
0005: $4341 = 263.14
0005: $4243 = 483.03
0005: $4342 = 444.28
0005: $4244 = 453.14
0005: $4343 = 114.07
0005: $4245 = 538.34
0005: $4344 = 69.86
0005: $4246 = 555.75
0005: $4345 = -121.81
0005: $4247 = 346.61
0005: $4346 = -249.44
0005: $4248 = 293.1
0005: $4347 = -268.3
0005: $4249 = 475.22
0005: $4348 = -316.52
0005: $4250 = 240.69
0005: $4349 = -368.72
0005: $4251 = 294.51
0005: $4350 = -452.35
0005: $4252 = 141.58
0005: $4351 = -583.38
0005: $4253 = 388.3
0005: $4352 = -463.78
0005: $4254 = 441.28
0005: $4353 = -618.13
0005: $4255 = 432.2
0005: $4354 = -563.67
0005: $4256 = 396.34
0005: $4355 = -718.78
0005: $4257 = 193.24
0005: $4356 = -892.96
0005: $4258 = 258.09
0005: $4357 = -974.5
0005: $4259 = 276.24
0005: $4358 = -976.37
0005: $4260 = 158.95
0005: $4359 = -1276.11
0005: $4261 = 229.38
0005: $4360 = -1289.37
0005: $4262 = 115.61
0005: $4361 = -1547.69
0005: $4263 = 88.19
0005: $4362 = -1500.54
0005: $4264 = -27.3
0005: $4363 = -1556.06
0005: $4265 = -72.6
0005: $4364 = -1456.25
0005: $4266 = -136.05
0005: $4365 = -1417.69
0005: $4267 = -89.73
0005: $4366 = -1398.22
0005: $4268 = -258.4
0005: $4367 = -1163.66
0005: $4269 = -198.03
0005: $4368 = -1088.76
0005: $4270 = -27.3
0005: $4369 = -1110.55
0005: $4271 = 10.22
0005: $4370 = -1230.44
0005: $4272 = -55.64
0005: $4371 = -882.11

// VARIABLES /////////////////////////////////////////////////////////////////////////////////////////////////////////////

// LOGIC /////////////////////////////////////////////////////////////////////////////////////////////////////////////////

03D3: print_help_always_allow 'Balloon Radar v0.1 by ~h~danssmnt~w~~n~~n~Press~h~ ~k~ ~TGSUB~ ~w~to turn off the Radar.'

// Setup balloons and then run main loop
037A: args 0 out 0 locals_base_index 0 call_func @INIT_BLIP_ARRAY_LOOP
0002: goto @MAIN_RADAR

:DRAW_UI
0204: set_text_scale 0.6 0.6
0266: set_text_right_justify 1

// $_1998 -> Global Variable for number of balloons burst by player
// That ~h~ is just so I can have an empty space for padding
02B1: display_text_with_number 480.0 256.0 gxt 'Balloons Burst: ~1~ / 99 ~h~' number $_1998
0026: return

// Initialize Blip Array for use
// Simple iteration over all array elements, setting to -1
:INIT_BLIP_ARRAY_LOOP
0001: wait 0

037A: args 0 out 0 locals_base_index 0 call_func @DRAW_UI

001B:   0@ == 99
0021: goto_if_true @INIT_BLIP_ARRAY_END

0004: 3@(0@,99) = -1

0007: 0@ += 1

0002: goto @INIT_BLIP_ARRAY_LOOP

// End Initialization
:INIT_BLIP_ARRAY_END
0026: return

:MANAGE_BALLOON_BLIP
0080:   locate_char_any_means_2d $PLAYER_CHAR coord $4174(0@,99) $4273(0@,99) radius 2@ 2@ sphere 0
0022: goto_if_false @MANAGE_BALLOON_BLIP_REM_CHECK

// Don't continue execution if blip has already been created before
001B:   3@(0@,99) == -1
0022: goto_if_false @MANAGE_BALLOON_BLIP_END

// Spawn balloon blip (Sprite 50 -> Balloon blip)
:MANAGE_BALLOON_BLIP_SPAWN
00C6: add_sprite_blip_for_coord $4174(0@,99) $4273(0@,99) 0.0 sprite 50 store_to 3@(0@,99)
0026: return

// Only remove balloon blip if it exists
:MANAGE_BALLOON_BLIP_REM_CHECK
001B:   3@(0@,99) == -1
0022: goto_if_false @MANAGE_BALLOON_BLIP_REM
0026: return

// Remove balloon blip (if it's too far)
:MANAGE_BALLOON_BLIP_REM
00BB: remove_blip 3@(0@,99)
0004: 3@(0@,99) = -1

:MANAGE_BALLOON_BLIP_END
0026: return

// Iterates over all balloons, spawns / removes blips according to player position
:MAIN_RADAR
0001: wait 0

// Press Up to exit the script
007F:   is_button_pressed 0 button 8
0021: goto_if_true @END_SCRIPT

037A: args 0 out 0 locals_base_index 0 call_func @DRAW_UI

// If loop has ended, reset index and start again
000F:   1@ > 98
0021: goto_if_true @MAIN_RADAR_RESET

037A: args 1 out 0 locals_base_index 0 call_func @MANAGE_BALLOON_BLIP 1@
0007: 1@ += 1

0002: goto @MAIN_RADAR

// Reset Array Index
:MAIN_RADAR_RESET
0004: 1@ = 0
0002: goto @MAIN_RADAR

// End Script, 1st -> Cleanup (remove all blips), 2nd -> Exit
:END_SCRIPT
0004: 0@ = 0
0267: print_help 'Exiting Balloon Radar...'

// Iterate over all blips in array and remove them
:END_SCRIPT2
0001: wait 0

001B:   0@ == 99
0021: goto_if_true @END_SCRIPT3

037A: args 1 out 0 locals_base_index 0 call_func @MANAGE_BALLOON_BLIP_REM 0@

0007: 0@ += 1

0002: goto @END_SCRIPT2

// Exit Script
:END_SCRIPT3
0023: terminate_this_script

// LOGIC /////////////////////////////////////////////////////////////////////////////////////////////////////////////////